package com.hongruan.action.Report;

import java.util.List;

import javax.annotation.Resource;

import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.hongruan.action.BaseAction;
import com.hongruan.bean.DataIntegra;
import com.hongruan.bean.zdybd.WSZLLZHZD;
import com.hongruan.model.ResultStatusModel;
import com.hongruan.service.ReportWstjService;

@Controller("ReportWstjAction")
@Scope("prototype")
public class ReportWstjAction extends BaseAction {

	private static final long serialVersionUID = 30981947503508030L;
	
	private static Logger logger = Logger.getLogger(ReportWstjAction.class);
	
	@Resource
	private ReportWstjService reportWstjService;
	
	private WSZLLZHZD wszllzhzd;
	private int page;
	private int pagesize;
	private long swjgUuid;
	private String sort1;
	private String sort2;
	
	public String wstjList(){
		
		logger.info("wstjList() begin");
		
        JSONObject json = new JSONObject();
        ResultStatusModel result = new ResultStatusModel();
        
        try{
        	String str = new String(sort1.getBytes("ISO8859_1"),"UTF-8");
        	List<WSZLLZHZD> wstj = this.reportWstjService.getWsList(wszllzhzd.getSlsj(),page,pagesize,swjgUuid,str,sort2);
        	if(wstj.size() > 0){
        		json.put("wstj", wstj);
            	result.setSuccess(true);
        	}else{
        		result.setSuccess(false);
        	}
        }catch(Exception e){
        	e.printStackTrace();
        	result.setSuccess(false);
        }
        json.put("result", result);
        this.writeAjaxResult(json.toString());
		return null;
	}
	
	public String getCbbmList(){
		logger.info("getFormById() begin");
		
        JSONObject json = new JSONObject();
        ResultStatusModel result = new ResultStatusModel();
        
        try{
        	List list = this.reportWstjService.getCbbmList(swjgUuid);
        	if(list.size() > 0){
        		json.put("list", list);
            	result.setSuccess(true);
        	}else{
        		result.setSuccess(false);
        	}
        }catch(Exception e){
        	e.printStackTrace();
        	result.setSuccess(false);
        }
        json.put("result", result);
        this.writeAjaxResult(json.toString());
		return null;
	}

	public WSZLLZHZD getWszllzhzd() {
		return wszllzhzd;
	}

	public void setWszllzhzd(WSZLLZHZD wszllzhzd) {
		this.wszllzhzd = wszllzhzd;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPagesize() {
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public long getSwjgUuid() {
		return swjgUuid;
	}

	public void setSwjgUuid(long swjgUuid) {
		this.swjgUuid = swjgUuid;
	}

	public String getSort1() {
		return sort1;
	}

	public void setSort1(String sort1) {
		this.sort1 = sort1;
	}

	public String getSort2() {
		return sort2;
	}

	public void setSort2(String sort2) {
		this.sort2 = sort2;
	}
	
}
